#include "stdafx.h"

#include "FAlpResIcon.h"
#include "Control/Container.h"



CFAlpResIcon::CFAlpResIcon(void)
	:CBaseICtrl()
{
	Init();
}

CFAlpResIcon::CFAlpResIcon(UINT nID)
	:CBaseICtrl( nID )
{
	Init();
}

CFAlpResIcon::CFAlpResIcon(wstring strCaption,UINT nID)
	:CBaseICtrl( strCaption,nID )
{
	Init();
}

CFAlpResIcon::CFAlpResIcon(DWORD dwStyle,wstring strCaption, const CRect &rc, UINT nID )
	:CBaseICtrl( dwStyle, strCaption, rc,nID )
{
	Init();
}

CFAlpResIcon::CFAlpResIcon(DWORD dwStyle, wstring strCaption, int x, int y, int cx, int cy, UINT nID )
	:CBaseICtrl( dwStyle, strCaption, x, y, cx, cy,  nID )
{
	Init();
}

CFAlpResIcon::~CFAlpResIcon(void)
{
	if( NULL!=m_pAlpRes )
	{
		delete m_pAlpRes;
		m_pAlpRes = NULL;
	}
}

void CFAlpResIcon::Init()
{
	m_pAlpRes = NULL;
}

// conctrol only have one image
BOOL	CFAlpResIcon::LoadRes( wstring strRes,CMyUnCompress* pPack )
{
	//return CBaseICtrl::LoadRes( strRes,pPack );

	BOOL br = FALSE;
	if ( m_pAlpRes==NULL )	
		m_pAlpRes = new CFAlphaRes();
	br = m_pAlpRes->LoadResData( strRes,pPack );

	return br;
}

//if contrl only have one img,this function just like LoadRes,here the same
BOOL	CFAlpResIcon::LoadStateRes( wstring strRes,int nState,CMyUnCompress* pPack )
{
	return CFAlpResIcon::LoadStateRes( strRes,nState,pPack );
}

void  CFAlpResIcon::Paint(CDC* pDC)
{
	return;
}

void  CFAlpResIcon::ImprovePaint( HANDLE hDB ,HDC hdc )
{
	//if ( ST_UNKNOW==m_nBtnState )return ;
	if ( !IsVisible() || m_rcControl.IsRectEmpty() || m_pAlpRes==NULL )
		return ;

	FASTBLTALPHABPP( m_pAlpRes, hDB,m_rcControl.TopLeft(),GetConBKSize()  );

}

void  CFAlpResIcon::Click(DWORD dwClick, POINT pt)
{

}

